// Tks VCB function formatNumberVND(e) { e.parseNumber({ format: "#,##0", locale: "us" }); e.formatNumber({ format: "#,##0", locale: "us" }); } function formatNumberUSD(e) { if (e.val().match(/^.+?\.0?$/)) return; e.parseNumber({ format: "#,##0.##", locale: "us" }); e.formatNumber({ format: "#,##0.##", locale: "us" }); } function formatNumberUSD00(e) { if (e.val().match(/^.+?\.0?$/)) return; e.parseNumber({ format: "#,##0.00", locale: "us" }); e.formatNumber({ format: "#,##0.00", locale: "us" }); } function formatNumberRate(e) { if (e.val().match(/^.+?\.0?$/)) return; e.parseNumber({ format: "#,##0.#####", locale: "us" }); e.formatNumber({ format: "#,##0.#####", locale: "us" }); } function formatExchangeRate(e) { e.parseNumber({ format: "#,##0.#####", locale: "us" }); e.formatNumber({ format: "#,##0.#####", locale: "us" }); } var ctrlDown = false; function handleKeyDown(e) { if (e.which == 17) ctrlDown = true; } function handleKeyUp(e) { if (e.which == 17) ctrlDown = false; } function ignoreEvent(e) { if (e.which >= 16 && e.which <= 18) return true; if (e.which >= 33 && e.which <= 40) return true; if (ctrlDown && (e.which == 65 || e.which == 67)) return true; return false; } // Execute when page is load $(document).ready(function() { $(".amountVND").each(function() { formatNumberVND($(this)); }); $(".amountUSD").each(function() { formatNumberUSD($(this)); }); $(".amountUSD00").each(function() { formatNumberUSD00($(this)); }); $(".amountRate").each(function() { formatNumberRate($(this)); }); $(".fomartRate").each(function() { formatExchangeRate($(this)); }); $(".amountVND").keydown(function(e) { handleKeyDown(e); }).keyup(function(e) { handleKeyUp(e); if (!ignoreEvent(e)) formatNumberVND($(this)); }); $(".amountUSD").keydown(function(e) { handleKeyDown(e); }).keyup(function(e) { handleKeyUp(e); if (!ignoreEvent(e)) formatNumberUSD($(this)); }); $(".panel-heading").click(function() { var aaa = $(this).next(); if ($(aaa).is(':visible')) { $(aaa).slideUp('fast'); } else { $(aaa).slideDown('fast'); } }); if ($('body').hasClass('login-page')) { var loginheight = window.innerHeight; // var loginheight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; elmheader = document.getElementById('header'); elmfooter = document.getElementById('footer'); var headerH = elmheader.clientHeight; var footerH = elmfooter.clientHeight; otherHeight = headerH + footerH + 30; $('#main').css('min-height', loginheight - otherHeight); /* Login page slider */ $('#login_slider').flexslider({ animation: "slide", controlNav: true, pauseOnAction: true }); } else { onResize = (function() { // Min-height main-right, and width window var element = document.getElementById('main_navi'); var live_height = element.clientHeight; var winHeight = window.innerHeight; elmheader = document.getElementById('header'); elmfooter = document.getElementById('footer'); var headerH = elmheader.clientHeight; var footerH = elmfooter.clientHeight; otherHeight = headerH + footerH + 30; $('#main').css('min-height', Math.max(winHeight - otherHeight, live_height)); }); $('#main').wrapAll("
"); $('#header').each( function() { $(this).find('.logo-box.container.clearfix,.nav-box, .user-box.container').wrapAll(''); }); $("body").append(''); onResize(); /* SHOW Navigation */ $('#sub-nav').click(function() { $inner = $('#main, .summary-inside'); $inner.stop().animate({ left: '243px' }, 500); $('#overlay_menu').css('min-height', $(document).height()); $('#overlay_menu').css({ 'display' : 'block' }) $('#outer_main').addClass('menu_open'); }); /* HIDE Navigation */ $('#overlay_menu').click(function() { $inner = $('#main, .summary-inside'); $inner.stop().animate({ left: '0' }, 500); $('#outer_main').removeAttr('menu_open'); $('#overlay_menu').removeAttr('style'); }); } // $('.main-right').wrapInner(""); /* Datepicker */ $('.datepicker').pikaday({ format: 'DD/MM/YYYY' }); /* Top-nav sub menu (Notifications) */ $(document).click(function() { $('.nav-box .noti').find('ul').hide(); $('.nav-box .noti').removeClass('showing'); $('#header').removeAttr('style'); }); $('.nav-box .noti').find('a').click(function() { if ($(this).siblings().size() > 0) { $('#header').css('overflow', 'visible'); $(this).siblings().toggle(); $(this).parent().toggleClass('showing'); return false; } }); /* Accordion Nanigation */ $('.main-navigation > li > span').click(function() { var thisItem = $(this).parent(); $(thisItem).children('ul').stop().slideToggle(function() { onResize(); }); $('.main-navigation > li').not(thisItem).children('ul').stop().slideUp(); }); /* SHOW-HIDE Table */ $('.table-title.toggle').click(function() { var thisTitle = $(this); $(thisTitle).next().slideToggle(function() { $(thisTitle).toggleClass('hiding'); }); }); /* Footer column menu */ $('#footer > #top').find('h3').click(function() { var thisH3 = $(this); var windowWidth = $(window).width(); if (windowWidth <= 700) { $(thisH3).next().slideToggle(); } }); /* Account detail addition-info */ $('.addition-info').hide().css("overflow", "hidden"); $('.more_button').click(function(e) { var link = $(this); $('.addition-info').slideToggle('fast', function() { if ($(this).is(":visible")) { $('.more_button').addClass('less_button'); } else { $('.more_button').removeClass('less_button'); } }); return false; }); /* Table */ $('.page-table table').wrap(''); $('.page-table td:empty').addClass('empty'); $('.page-table table').each(function() { $(this).find('th').each(function(index) { var indexNew = index + 1, tableNew = $(this).parents('table'); $(tableNew).find('td:nth-child(' + indexNew + ')').wrapInner('').prepend('' + tooltipText + '